<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>我的工资</title>
		<link rel="stylesheet" href="../static/css/xadmin.css">
		<link rel="stylesheet" href="../static/css/xadmin.css">
		<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
		<script src="../static/lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="../static/js/xadmin.js"></script>
		<script src="../static/js/my.js"></script>
	</head>
	<body>
		<select id="moneyTime" name="moneyTime" style="width: 150px;height: 37px">
		    <option value="">请选择月份</option>
		    <option value="01">1</option>
		    <option value="02">2</option>
			 <option value="03">3</option>
			  <option value="04">4</option>
			   <option value="05">5</option>
			    <option value="06">6</option>
				 <option value="07">7</option>
				 <option value="08">8</option>
				 <option value="09">9</option>
				 <option value="10">10</option>
				 <option value="11">11</option>
				 <option value="12">12</option>
		</select>
		<input type="button" class="layui-btn layui-btn-radius layui-btn-warm" onclick="search()" value="查询" >
		<table  class="layui-table" >
		    <thead>
		    <th>编号</th>
		    <th>姓名</th>
		    <th>基本工资</th>
			<th>当月绩效</th>
		    <th>奖金</th>
			<th>罚款</th>
			<th>应发工资</th>
			<th>时间</th>
			
		    </thead>
		    <tbody>
		   
		    </tbody>
		</table>
		
		
		
		
		<!-- 显示页码信息的div -->
		<div align="center">
		    <button type="button" class="layui-btn layui-btn-radius layui-btn-warm"onclick="pre()">
		       <i class="layui-icon">&#xe603;</i>
		     </button>
		     <button type="button" class="layui-btn layui-btn-radius layui-btn-warm"onclick="next()">
		        <i class="layui-icon">&#xe602;</i>
		      </button>
		    一共有<span id="total"></span>条数据
		    一共有<span id="totalPage"></span>页
		    当前第<span id="cur"></span>页
			
		</div>
		
	</body>
</html>
<script>
	//文档加载事件
	$(function(){
			//在文档加载时查询所有记录
		
		
			selectMoney();
			
		})
	var month;
	
	var page=1;
	var row=6;
	//4.//上一页/下一页
	var prePage=0;
	var nextPage=0;
	//上一页
	function pre()
	{
		page=prePage;
		
		selectMoney();
	
	}
	//下一页
	function next()
	{
		page=nextPage;
		selectMoney();
		
	}
	function selectMoney()
	{
		var userId="111";
		var userName="小王子";
		var moneyTime=$("#moneyTime").val();
		$.ajax({
				url:address+"/check/selectMoneyAjax",
				type:"get",
				data:{"page":page,"row":row,"userName":userName,"userId":userId},
				dataType:"json",
				success:function (data) {
				   
				   //遍历分页数据,拼接字符串
				  
				 var html="";
				 for(var i=0;i<data.list.length;i++)
				 {
					 month=data.list[i].moneyTime.split("-")[1];
					 if(month==moneyTime||moneyTime=="")
					 {
						 html+="<tr>"
							+"<td>"+data.list[i].userId+"</td>"
							+"<td>"+data.list[i].userName+"</td>"
							+"<td>"+data.list[i].basicMoney+"</td>"
							+"<td>"+data.list[i].meritMoney+"</td>"
							+"<td>"+data.list[i].addMoney+"</td>"
							+"<td>"+data.list[i].punishMoney+"</td>"
							+"<td>"+data.list[i].totalMoney+"</td>"
							+"<td>"+data.list[i].moneyTime+"</td>"
						  +"</tr>"
					  }
				 }
				    $("tbody").html(html);
				    
				    $("#total").text(data.total);
				    $("#totalPage").text(data.totalPage);
				    $("#cur").text(data.cur);
				   prePage=data.pre;
				   nextPage=data.next;
				
				    }
			})
	}
	function search()
	{
		selectMoney();
	}
	
</script>